<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="../utils.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body><script type="text/javascript">
	var obj1 = {
	    id: 1,
	    name: 'zhangsan',
	    age: 18,
	    className: 2003
	}
	
	  var str = 'id=1&name=zhangsan&age=18&className=2003'
	
	 var res =ConvertObj(obj1)
	 var res1=ConvertStr(str)
	/* function ConvertObj(obj) {
		var str = '';
		//遍历对象
		for (var key in obj) {
			str += key + '=' + obj[key] + '&';
	
		     str.substr(0, str.length - 1);
		
		}
		return  str
			
	} */
	console.log(res);
	 console.log(res1);
	</script>
	</body>
</html>
